#pragma once


class CSqlite3Access :
	public IDataAccess
{
public:
	CSqlite3Access(void);
	~CSqlite3Access(void);

    bool    GetVersion(DB_VERSION* pVer);

	bool	Init() ;
	bool	Close();
	void	Release();

	bool	ChangePassword(const char* strName, const char* strPassword) ;
	bool	AddAccount(const char* strName, const char* strPassword) ;
	bool	CheckAccount(const char* strName, const char* strPassword);
	bool	DeleteAccount(const char* strName) ;
	bool	SetAllAccount(CListViewCtrl* pCtrl);

    bool    Log(const char* strName, const char* strLog);
    bool    SetLogCtrl(int date,CListViewCtrl* pCtrl);

	bool    AddBasicInfo( Basic_Info_t* pInfo);
    bool    UpdateBasicInfo(Basic_Info_t* pInfo);
    bool    SetBasicInfoCtrl(const char* id, const char* name, CListViewCtrl* pCtrl);
	bool    SetBasicInfoCtrlEx(const char* id, const char* name,const char* native_place, const char* nationality,
		const char* mobile, const char* phone, const char* mail, CListViewCtrl* pCtrl);


    bool    GetBasicInfo(const char* id, Basic_Info_t* pInfo);
    bool    DeleteBasicInfo(const char* id);

    bool    AddStatusInfo(Status_Info_t* pInfo);
    bool    UpdateStatusInfo(Status_Info_t* pInfo);
    bool    GetStatusInfo(const char* id, Status_Info_t* pInfo);
    bool    DeleteStatusInfo(const char* id);
    
	bool	AddResultInfo(Result_Info_t* pInfo);
	bool	UpdateResultInfo(Result_Info_t* pInfo);
	bool	SetResultInfoCtrl(const char* id, CListViewCtrl* pCtrl);
	bool	DeleteResultInfo(const char* id, int time);

    bool    AddLoginInfo(Login_Info_t* pInfo);
    bool    UpdateLoginInfo(Login_Info_t* pInfo);
    bool    IsUserLogin(const char* id) ;
    bool    SetLoginInfoCtrl(CListViewCtrl* pCtrl);
    bool    SetLoginInfoCtrl2(int date,CListViewCtrl* pCtrl);

    bool    AddImageInfo(const char* id, char* buf, int length, int width, int height);
    bool    UpdateImageInfo(const char* id, char* buf, int length, int width, int height);
    bool    GetImageInfo(const char* id, char* buf, int* pLength, int* pwidth, int* pheight);
    bool    DeleteImageInfo(const char* id);

    bool    GetSetting(const char* setting, int* value);
    bool    SetSetting(const char* setting, int value);

    bool    GetReport(const int type, const int year, const int quarter, const int month, int* result);

	bool	Test(const char* strName, const char* strPassword);

protected:
	sqlite3*	m_db;
};
